<%@ page import="java.sql.*"%>
<%@ page import="java.io.*"%>
<%@ page import="java.util.*" %>
<%@ page import="java.security.*" %>
<%@ include file="dbconn.jsp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>New User</title>
</head>
<body>
<table width=100% bordercolor="#C6D4E1" bgcolor="#C6D4E1">
<tr><th scope="col"><div align="center"><h1 align="center"><font face="Times New Roman">Tros - Online Banking System </font></h1></div></th></tr>
</table>
&nbsp;
<fieldset>
<legend><b>Forgot Credentials</b></legend>
&nbsp;
<table width=50% align=center cellpadding=5 cellspacing=0 bgcolor="#D5FFD5">
<tr><td>&nbsp;</td></tr>
<% 
	    
 
     String lname = request.getParameter("lname").trim();
     String dob = request.getParameter("dob").trim();
     String mailID = request.getParameter("email").trim();     

    try 
	{     	
		PreparedStatement state=connect.prepareStatement("INSERT INTO RESETREQ VALUES(?,?,?)");
		state.setString(1,lname);
		state.setString(2,dob);
		state.setString(3,mailID);

		int val=state.executeUpdate();
		
		if(val>0){ %>
			<tr><td><div align="center">
			  <%out.println("Request for Resetting Credentials is done"); %>
			  </div></td></tr>
			  <tr><td><div align="center">
		      <%out.println("Please check your e-mail for login Credentials"); %>
		      </div></td></tr>
		      <tr><td><div align="center">
			  <%out.println("<a href='login.jsp'>Login</a>"); %>
			  </div></td></tr><%
			;}
		
		state.close();
		connect.close();
	} catch (Exception e) {	
		System.out.println("----------> error ------>"+e.getMessage());
		%>
		<tr><td><div align="center">
		  <%out.println("Details provided by you already exists for Account Request"); %>
		  </div></td></tr>
		  <tr><td><div align="center">
		  <%out.println(" Please check your e-mail regarding information about your request "); %>
		  </div></td></tr>
		<tr><td><div align="center">
		  <%out.println("<a href='login.jsp'>Login</a>"); %>
		  </div></td></tr><%
		}
%>
</table>
</fieldset>
</body>
</html>